package cn.edu.scau.cmi.chenxiaoqin.client;

import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import cn.edu.scau.cmi.chenxiaoqin.mybatis.dao.StudentMapper;
import cn.edu.scau.cmi.chenxiaoqin.mybatis.entity.Student;
import cn.edu.scau.cmi.chenxiaoqin.mybatis.entity.StudentEntity;



public class SpringMybaitsClient {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		ApplicationContext applicationContext=new ClassPathXmlApplicationContext(
		                new String[]{"applicationContext01.xml"});
		
	StudentMapper studentService=(StudentMapper)applicationContext.getBean("studentMapper");
	Student student=new Student();
	student.setName("张三");
	student.setNumber(1234L);
	student.setTutor(12L);
	System.out.println(studentService.saveStudent(student));
	List<StudentEntity> studentList=studentService.listStudentEntitys();
	  for(StudentEntity stu :studentList) {
		System.out.println(stu);
	   }		
	}
}
